/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package testmanagementclient2;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.ZipOutputStream;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.SOAPMessage;

/**
 * This Interface defines an abstract Archive Packaging class.  The following
 * conventins are used with the methods defined herein:
 *
 *      <T> here T refers to some Base Archive type such as ZipFileInputStream
 *       XXXXX refers to some data type as input or output such as byte[]
 *
 *      Methods whose names follow the name pattern of
 *      XXXXX toXXXXX(<T> input) will convert the Base Packager type <T>
 *      to the a resulting format XXXXX that is STILL IN A COMPRESSED FORMAT
 *      for example toByteArray will produce a byte[] array that can be written
 *      to disk and will completely recreate a file of the Base Archive type.
 *
 *      Methods whose names follow the name is
 *      <T> pack(XXXXX input) will convert uncompressed data of type XXXXX
 *      to the compressed Archive of type <T>.
 *
 *      Methods whose names follow the name pattern of
 *      XXXXX unpackAsXXXXX(<T> input) will produce an uncompressed object of
 *      type XXXXX
 *
 *
 * @author rrm46582
 */
public interface ArchivePackager<A,T> // A = ArchiveObject, T = Target object
{
    /**
     * This method will convert the input Archive Format to a
     * byte[] still in compressed format.  That is if you were to write the
     * byte[] to disk it would recreate the original archive file.
     * @param inParam
     * @return
     */
    byte []         toByteArray(A inParam);

    /**
     * This method will convet the input ArchiveFormat to an
     * InputStream still in compressed format.  That is if you were to write
     * the contents of the InputStream to disk it would recreate the original
     * archive file.
     * @param inParam
     * @return
     */
    InputStream     toInputStream(A inParam);

    /**
     * This method will take an uncompressed byte[] and compress it into
     * the specified archve object.
     * @param inParam
     * @return
     */
    A               pack(byte[] inParam);

    /**
     * This method will take an uncompressed InputStream and compress it
     * into the specified archive object
     * @param inParam
     * @return
     */
    A               pack(InputStream inParam);

    /**
     * This method will take the specified target object and compress it
     * into the specified archive obejct.
     * @param inParam
     * @return
     */
    A               pack(T inParam);

    /**
     * This method will take a specified Archive object and decompress it
     * into a byte[]
     * @param inParam
     * @return
     */
    byte []         unpackAsByteArray(A inParam);

    /**
     * This method will take a specified Archive object and decompress it
     * into an Inputstream
     * @param inParam
     * @return
     */
    InputStream     unpackAsInputStream(A inParam);

    /**
     * This method will take the specified Archive object and
     * decompress it into a Target object.
     * @param inParam
     * @return
     */
    T               unpack(A inParam);
}
